;(function(){
	var WindUtil = {};
	/**
	* 获取风向的中英文描述
	* @param angle 风向角度
	*/
	WindUtil.getWindDire = function(direId){
		var windDirName = [{"CH":"北风","EN":"S"}, 
							{"CH":"北东北","EN":"SSW"},
		                    {"CH":"东北风","EN":"SW"},
							{"CH":"东东北","EN":"WSW"},
		                    {"CH":"东风","EN":"W"}, 
							{"CH":"东东南","EN":"WNW"},
		                    {"CH":"东南风","EN":"NW"},
							{"CH":"南东南","EN":"NNW"},
		                    {"CH":"南风","EN":"N"},
							{"CH":"南西南","EN":"NNE"},
		                    {"CH":"西南风","EN":"NE"},
							{"CH":"西西南","EN":"ENE"},
		                    {"CH":"西风","EN":"E"},
							{"CH":"西西北","EN":"ESE"},
		                    {"CH":"西北风","EN":"SE"},
							{"CH":"北西北","EN":"SSE"},
		                    {"CH":"北风","EN":"S"}];
		var wd = null;
		if(!TypeUtil.isUndefined(direId)){
			wd = windDirName[direId];
		} else {
			wd = {"CH":"","EN":""};
		}
		return wd;
	};

	/**
	* 计算16风向
	* @param angle 风向角度
	*/
	WindUtil.calcWindDire = function(angle){
		if(!$.isNumeric(angle*1)){
			return '';
		}
		return Math.floor(angle*1 / 22.5);
	};
	
	WindUtil.getWindPower = function (fs){
		if(fs)
			fs=parseFloat(fs);
		else
			return "";
		if(fs!=0){
			var level=0;
			if(fs > 0 && fs <= 0.2)
				level=0;
			else if(fs >= 0.2 && fs < 1.6)
				level=1;
			else if(fs >= 1.6 && fs < 3.4)
				level=2;
			else if(fs >= 3.4 && fs < 5.4)
				level=3;
			else if(fs >= 5.4 && fs < 8)
				level=4;
			else if(fs >= 8 && fs < 10.8)
				level=5;
			else if(fs >= 10.8 && fs < 13.9)
				level=6;
			else if(fs >= 13.9 && fs < 17.2)
				level=7;
			else if(fs >= 17.2 && fs < 20.8)
				level=8;
			else if(fs >= 20.8 && fs < 24.5)
				level=9;
			else if(fs >= 22.5 && fs < 28.5)
				level=10;
			else if(fs >= 28.5 && fs <= 32.6)
				level=11;
			else if(fs>32.6)
				level=12;
			else 
				level=0;
			return level;
		}
		else
			return "";
	};
	
	window.WindUtil = WindUtil;
})()